---
title: 'Migration guide from Storybook 8.x to 9.1'
sidebar:
  order: 2
  title: Migrate from 8 to 9
---

[full-migration-notes]: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#from-version-8x-to-900

Storybook 9 improves performance, compatibility, and stability. Its key features include:

- 🔋 Storybook Test, a batteries-included testing tool in your Storybook
- 🧪 Component testing
- ♿️ Accessibility testing
- 🛡️ Test coverage
- 🪶 48% lighter bundle
- ⚛️ React Native for device and web
- 🏷️ Tags-based story organization

This guide is meant to help you **upgrade from Storybook 8.x to 9.1** successfully!

<Callout variant="info">
  **Migrating from Storybook 6 or 7?**

  We have prior migration guides for:

  - [Storybook 7.x to 8.x](../../../release-8-6/docs/migration-guide/index.mdx)
  - [Storybook 6.x to 8.x](../../../release-8-6/docs/migration-guide/from-older-version.mdx)
</Callout>

## Major breaking changes

The rest of this guide will help you upgrade successfully, either automatically or manually. But first, there are some [breaking changes][full-migration-notes] in Storybook 9. Here are the most impactful changes you should know about before you go further:

* [Packages have been consolidated/removed](#package-structure-changes)
* [Essential addons moved to core](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#essentials-addons-viewport-controls-interactions-and-actions-moved-to-core)
* [Test addon renamed from `experimental-addon-test` to `addon-vitest`](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#experimental-test-addon-stabilized-and-renamed)
* [`nextjs-vite` framework stabilized](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#nextjs-vite-builder-stabilized)
* [Removed Webpack builder support for Preact, Vue, and Web Components in favor of Vite](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#dropped-webpack5-builder-support-in-favor-of-vite)
* [Manager builder removed alias for `util`, `assert` and `process`](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#manager-builder-removed-alias-for-util-assert-and-process)
* Ecosystem updates
  * [Node 20+ is now required](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#nodejs--20)
  * [Angular 18+ is now required](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#angular-require-v18-and-up)
  * [Lit v3+ is now required](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#lit--require-v3-and-up)
  * [Next.js 14+ is now required](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#nextjs-require-v14-and-up)
  * [Svelte 5+ is now required](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#svelte-require-v5-and-up)
  * [Vite 5+ is now required](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#vite-4)
  * [Vitest 3+ is now required](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#vitest-addon-former-storybookexperimental-addon-test-vitest-20-support-is-dropped)
  * [npm 10+ is now required](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#package-managers)
  * [pnpm 9+ is now required](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#package-managers)
  * [yarn 4+ is now required](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#package-managers)
  * [TypeScript 4.9+ is now required](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#typescript--49)

If any of these changes apply to your project, please read through the linked migration notes before continuing.

If any of these new requirements or changes are blockers for your project, we recommend to continue using Storybook 8.x.

You may wish to read the [full migration notes][full-migration-notes] before migrating. Or you can run the upgrade command below and we’ll try to take care of everything for you!

## Automatic upgrade

To upgrade your Storybook, run the [upgrade](./upgrading.mdx) command in the root of your repository:

{/* prettier-ignore-start */}

<CodeSnippets path="storybook-upgrade.md" />

{/* prettier-ignore-end */}

This will:

1. Find all of the Storybook projects in your repository
2. For each project
   1. Determine that none of the [breaking changes](#major-breaking-changes) apply to your project
      * If they do, you will receive instructions on how to resolve them before continuing
   2. Upgrade your Storybook dependencies to the latest version
   3. Run a collection of *automigrations*, which will:
      * Check for common upgrade tasks
      * Explain the necessary changes with links to more information
      * Ask for approval, then perform the task automatically on your behalf

## New projects

To add Storybook to a project that isn’t currently using Storybook:

{/* prettier-ignore-start */}

<CodeSnippets path="create-command.md" copyEvent="CreateCommandCopy" />

{/* prettier-ignore-end */}

This will:

1. Figure out which renderer (React, Vue, Angular, Web Components), builder (Webpack, Vite), or meta-framework (Next.js, SvelteKit) you’re using
2. Install Storybook 9 and auto-configure it to mirror project settings

## Troubleshooting

The automatic upgrade should get your Storybook into a working state. If you encounter an error running Storybook after upgrading, here’s what to do:

1. Try running the [`doctor` command](../api/cli-options.mdx#doctor) to check for common issues (such as duplicate dependencies, incompatible addons, or mismatched versions) and see suggestions for fixing them.
2. If you’re running `storybook` with the `dev` command, try using the `build` command instead. Sometimes `build` errors are more legible than `dev` errors!
3. Check [the full migration notes][full-migration-notes], which contains an exhaustive list of noteworthy changes in Storybook 9. Many of these are already handled by automigrations when you upgrade, but not all are. It’s also possible that you’re experiencing a corner case that we’re not aware of.
4. Search [Storybook issues on GitHub](https://github.com/storybookjs/storybook/issues). If you’re seeing a problem, there’s a good chance other people are too. If so, upvote the issue, try out any workarounds described in the comments, and comment back if you have useful info to contribute.
5. If there’s no existing issue, you can [file one](https://github.com/storybookjs/storybook/issues/new/choose), ideally with a reproduction attached. We’ll be on top of Storybook 9 issues as we’re stabilizing the release.

If you prefer to debug yourself, here are a few useful things you can do to help narrow down the problem:

1. Try removing all addons that are not in the `@storybook` npm namespace (make sure you don't remove the `storybook` package). Community addons that work well with 8.x might not yet be compatible with 9.x, and this is the fastest way to isolate that possibility. If you find an addon that needs to be upgraded to work with Storybook 9, please post an issue on the addon’s repository, or better yet, a pull request to upgrade it!
2. Another debugging technique is to bisect to older prerelease versions of Storybook to figure out which release broke your Storybook. For example, assuming that the current prerelease of Storybook is `9.0.0-beta.56`, you could set the version to `9.0.0-alpha.0` in your `package.json` and reinstall to verify that it still works (`alpha.0` should be nearly identical to `8.6.x`). If it works, you could then try `9.0.0-beta.0`, then `9.0.0-beta.28` and so forth. Once you’ve isolated the bad release, read through its [CHANGELOG](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.prerelease.md) entry and perhaps there’s a change that jumps out as the culprit. If you find the problem, please submit an issue or pull request to the Storybook monorepo and we’ll do our best to take care of it quickly.

## Package structure changes

The following packages are no longer published. Instead they have been consolidated into Storybook's core package, `storybook`. If a consolidated package had exports, those are available via the replacement path in the table below. See the [full migration notes](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#dropped-support-for-legacy-packages) for details.

| Removal                         | Replacement             |
| ------------------------------- | ----------------------- |
| `@storybook/addon-actions`      | `storybook/actions`     |
| `@storybook/addon-backgrounds`  | N/A                     |
| `@storybook/addon-controls`     | N/A                     |
| `@storybook/addon-highlight`    | `storybook/highlight`   |
| `@storybook/addon-interactions` | N/A                     |
| `@storybook/addon-measure`      | N/A                     |
| `@storybook/addon-outline`      | N/A                     |
| `@storybook/addon-toolbars`     | N/A                     |
| `@storybook/addon-viewport`     | `storybook/viewport`    |
| `@storybook/manager-api`        | `storybook/manager-api` |
| `@storybook/preview-api`        | `storybook/preview-api` |
| `@storybook/test`               | `storybook/test`        |
| `@storybook/theming`            | `storybook/theming`     |

The following packages have been consolidated and moved into an internal path to indicate that they are now for internal usage only. They will continue to work in `9.x` releases, but will likely be removed in `10.0`. See the [full migration notes](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#dropped-support-for-legacy-packages) for details.

| Deprecation                  | Replacement                           |
| ---------------------------- | ------------------------------------- |
| `@storybook/builder-manager` |	`storybook/internal/builder-manager` |
| `@storybook/channels`        |	`storybook/internal/channels`        |
| `@storybook/client-logger`   |	`storybook/internal/client-logger`   |
| `@storybook/components`      |	`storybook/internal/components`      |
| `@storybook/core-common`     |	`storybook/internal/common`          |
| `@storybook/core-events`     |	`storybook/internal/core-events`     |
| `@storybook/core-server`     |	`storybook/internal/core-server`     |
| `@storybook/csf-tools`       |	`storybook/internal/csf-tools`       |
| `@storybook/docs-tools`      |	`storybook/internal/docs-tools`      |
| `@storybook/manager`         |	`storybook/internal/manager`         |
| `@storybook/node-logger`     |	`storybook/internal/node-logger`     |
| `@storybook/preview`         |	`storybook/internal/preview`         |
| `@storybook/router`          |	`storybook/internal/router`          |
| `@storybook/telemetry`       |	`storybook/internal/telemetry`       |
| `@storybook/types`           |	`storybook/internal/types`           |

Addon authors may continue to use the internal packages, there is currently not yet any replacement.

## Optional migrations

In addition to the automigrations and manual migrations above, there are also optional migrations that you should consider. These are features that we’ve deprecated in Storybook 9 (but remain backwards compatible), or best practices that should help you be more productive in the future.

### `test-runner` to `addon-vitest`

`addon-vitest` and the rest of the [Storybook Test experience](https://storybook.js.org/blog/storybook-test-sneak-peek/) is designed to supercede the `test-runner`. It's faster and provides a better experience for writing and running tests. If your project uses React, Vue, or Svelte and is built with Vite, you should consider migrating to `addon-vitest`, by following the [installation instructions](../writing-tests/integrations/vitest-addon/index.mdx#automatic-setup).

### CSF 2 to CSF 3

There are [many good reasons](/blog/storybook-csf3-is-here/) to convert your stories from CSF 2 to CSF 3. We provide a codemod which, in most cases, should automatically make the code changes for you (make sure to update the glob to fit your files):

{/* prettier-ignore-start */}

<CodeSnippets path="storybook-migrate-csf-2-to-3.md" />

{/* prettier-ignore-end */}